<template>
    <div class="add-form" v-show="dialogValue" style="overflow:auto;">
        <ProfessorList title="新增" v-if="show == 1" ref="ProfessorListRef" :project-id="currentDetail.id" @next="onNextProfessor" />
        <DeptList title="新增" v-if="show == 2" ref="DeptListRef" :project-id="currentDetail.id" @next="onTotal" @pre="onPreProfessor" />
        <TotalList
            title="新增"
            v-if="show == 3"
            ref="TotalListRef"
            :project-id="currentDetail.id"
            :detail="currentDetail"
            @pre="onPreTotal"
            @send="onSend"
        />
        <InviteMsg
            title="新增"
            ref="InviteMsgRef"
            :current-detail="currentDetail"
            @success="onSuccess"
        />
    </div>
</template>

<script>
import ProfessorList from '@/views/meeting/process/first/user-invite/professor-list'
import DeptList from '@/views/meeting/process/first/user-invite/dept-list'
import TotalList from '@/views/meeting/process/first/user-invite/total-list'
import InviteMsg from '@/views/meeting/process/first/user-invite/invite-msg'
export default {
    name: 'UserInvite',
    components: {
        ProfessorList,
        DeptList,
        TotalList,
        InviteMsg
    },
    props: {
        currentDetail: Object
    },
    data() {
        return {
            dialogValue: false,
            show: '1',
        }
    },
    watch: {
        dialogValue: {
            handler() {
                if (this.dialogValue) {
                    this.show = '1'
                } else {
                    this.show = ''
                }
            },
            immediate: true
        }
    },
    methods: {
        open() {
            this.dialogValue = true
        },
        onNextProfessor() {
            this.show = '2'
        },
        onTotal() {
            this.show = '3'
        },
        onPreProfessor() {
            this.show = '1'
        },
        onPreTotal() {
            this.show = '2'
        },
        onSend() {
            this.$refs.InviteMsgRef.open()
        },
        onSuccess() {
            this.$emit('get-page')
        }
    }
}
</script>

<style scoped lang="scss">
</style>
